// =============================================================
// CCubeInterpreter
// ---------------------------------------
// Author : Woo-Hyun Kim
// Email : woorung@gmail.com or woorung@nhncorp.com
// Date : Feb. 7, 2007
// =============================================================
#ifndef CCubeInterpreterH
#define CCubeInterpreterH
//-----------------------------------------------------------------
#include <iostream>
#include <iterator>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <fstream>
#include <string>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <dirent.h>

#include "CInterpreter.h"
#include "CFileManager.h"
#include "CSmartString.h"
#include "CDocument.h"

#define LOCAL_CUBE_PATH "/mnt/cube"
#define MAX_CONCURRENT_CP_COUNT 5

using namespace std;
//-----------------------------------------------------------------
class CCubeInterpreter : public CInterpreter {
public :
    map<string,string> cubes;

	CCubeInterpreter(string &name);
	~CCubeInterpreter();

	void run();

	// common functions
	void inspectParameters(string &name, map<string,string> &parameters);
	void generateDirectory(string &default_path, string &current_path);
	void removeDirectory(string &target_path);

	// these methods must be overridden in subclasses
	void initializeEnvironment(string &name, map<string,string> &parameters);
	void parallelProcessing(string &name, map<string,string> &parameters);
	void parallelDistribution(string &name, map<string,string> &parameters);
	void doAggregation(string &name, map<string,string> &parameters);
};
//----------------------------------------------------------------
#endif
